<?php

// dynamic class loader 
class ClassLoader
{
    private	$_paths = array();
    
    public function addPath($path)
    {
	foreach ($this->_paths as $p) 
	{
	    if ($p == $path) return;
	}
	$this->_paths[] = $path;
    }
    
    public function load($classname, $filename)
    {
	$loaded = false;
		
	foreach ($this->_paths as $path)
	{
	    if (is_file($path.$filename) && is_readable($path.$filename))
	    {
		include_once($path.$filename);
		$loaded = true;
	    }
	}
	
	if (!$loaded) die("Cannot load class: ".$classname);
    }
}

?>